#include<bits/stdc++.h>
using namespace std;
const int N=5e5+5;
long long ans,n,m,q,x,y,bj[N],f[N],pr[N],mn;
int find(int i)
{
	if(f[i]==i) return i;
	return f[i]=find(f[i]); 
}
struct node{
	long long l,r;
}a[N];
bool cmp(node i,node j)
{
	return i.r<j.r; 
}
int main()
{
	freopen("destory.in","r",stdin);
	freopen("destory.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m>>q;
	for(int i=1;i<=n;++i)
		f[i]=i;
	for(int i=1;i<=m;++i)
	{
		cin>>x>>y;
		if(find(x)!=find(y))
			f[f[x]]=f[y];
	}
	for(int i=1;i<=n;++i)
		if(bj[find(i)]) pr[i]=bj[f[i]],bj[f[i]]=i;
	for(int i=1;i<=q;++i)
	{
		cin>>a[i].l>>a[i].r;
		mn=1e18;
		ans=0;
		for(int j=a[i].r;j>=a[i].l;--j)
		{
			mn=min(pr[j]-1,mn);
			if(mn<a[i].l) break;
			ans=max(ans,mn-a[i].l+1+a[i].r-j+1);
		}
		cout<<a[i].r-a[i].l+1-ans<<'\n';
	}
	return 0;
 } 
